<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">
    <title>测试报告</title>
       <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.5.0/css/bootstrap.min.css">
    <script src=" https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/echarts/5.1.2/echarts.min.js"></script>
    <!--    页面样式-->
    <style type="text/css">
        /*标题样式*/

        .main {
            background: rgba(7, 10, 88, 0.99);
        }

        .title {
            width: auto;
            height: 80px;
            text-align: center;
            font: bolder 30px/80px "Microsoft YaHei UI";
            color: #fff;
            background: rgba(3, 14, 70, 0.5);
            border-bottom: solid 1px rgb(3, 14, 70);
            margin-bottom: 10px;
        }

        .content-box {
            height: 700px;
            width: 100%;
            display: flex;
            margin-bottom: 10px;
        }

        .box1 {
            flex: 3;
        }

        .box2 {
            flex: 5;
            margin: 0 10px;
        }

        .box3 {
            flex: 4;
        }

        .panel {
            position: relative;
            border: 1px solid rgba(25, 186, 139, 0.17);
            background: rgba(3, 14, 70, 0.5);
            padding: 0 10px 50px;
            margin-bottom: 10px;
        }

        .panel h2, .test_info h2 {
            height: 40px;
            line-height: 40px;
            text-align: center;
            color: #007bff;
            font-size: 20px;
            font-weight: bold;
            margin: 0;
        }

        .panel .chart {
            height: 250px;
        }

        .panel .chart2 {
            height: 350px;
        }

        .panel .desc {
            height: 150px;
        }

        .panel .desc .info {
            font: normal 18px/25px "Microsoft YaHei UI";
            color: #fff;
            display: flex;
        }

        .panel .desc .info div {
            padding: 10px;
            border: solid 1px #6c757d;
        }

        .panel .desc .info div span {
            margin-left: 20px;
        }


        /* 执行信息样式   */
        .test_info {
            width: 100%;
            padding: 20px 100px;
            background: rgba(3, 14, 70, 0.5);

        }

        .table td, .table th {
            border: solid 1px #5765a4 !important;
            padding: 0 !important;
            line-height: 40px;
            text-align: center;
            height: 40px;
            color: #fff;
        }

        select {
            border: 0;
            padding: 0;
            margin: 0;
            height: 2em;
            width: 8em;
            margin-left: 2em;
        }

        option {
            text-align: center;
            height: 36px;
            font: none 18px/36px "Microsoft YaHei UI";
            color: #28a745 !important;
        }

        .test_log {
            background: rgba(163, 171, 189, 0.15);
            width: 100%;
            height: 50px;
            border-top: none;
            border-bottom: none;
            display: none;
            text-align: left;
        }

        .test_log td {
            text-align: left;
            height: 30px;
            margin: 0;
            padding-left: 3em;
            padding-right: 3em;
            font: none 18px/24px "Microsoft YaHei UI";
        }

        pre {
            margin: 0;
            white-space: pre-wrap;
            white-space: -moz-pre-wrap;
            white-space: -o-pre-wrap;
            word-wrap: break-word;
            color: #fff;
            line-height: 22px;
            font-size: 14px
        }

        .chart4 {
            overflow: auto;
            width: 100%;
            height: 600px;

        }

        .chart4::-webkit-scrollbar {
            width: 10px;

        }

        .chart4::-webkit-scrollbar-thumb {
            /*滚动条里面小方块*/
            border-radius: 5px;
            -webkit-box-shadow: inset 0 0 5px rgba(4, 0, 225, 0.62);
            background: #272789;
            height: 10px;

        }

        .chart4::-webkit-scrollbar-track {
            /*滚动条里面轨道*/
            -webkit-box-shadow: inset 0 0 5px rgba(0, 21, 255, 0.54);
            border-radius: 10px;
            background: rgba(214, 214, 214, 0.64);

        }

        /*详细内容描述的小标题*/
        .table_title {
            text-align: center;
            background: rgba(1, 2, 37, 0.72);
            font: bold 18px/30px 'Microsoft YaHei UI';
            color: #fff;
            border-radius: 10px
        }

    </style>

</head>
<body>
<div class="main">
    <div class="title">
        测试报告
    </div>
    <div class="content-box">
        <div class="box1">
            <div class="panel">
                <h2>执行结果</h2>
                <div class="chart" id="char3"></div>
                <div class="panel-footer"></div>
            </div>
            <div class="panel ">
                <h2>成功占比</h2>
                <div class="chart" id="char1"></div>
                <div class="panel-footer"></div>
            </div>
        </div>
        <div class="box2">
            <div class="panel">
                <h2>运行信息</h2>
                <div class="desc">

                    <div class="info">
                        <div style="flex:5">
                            <button type="button" class="btn btn-primary btn-sm">开始时间</button>
                            <span>2024-12-11 10:59:24</span>
                        </div>
                        <div style="flex:5">
                            <button type="button" class="btn btn-primary btn-sm">用例总数</button>
                            <span>35</span>
                        </div>
                    </div>
                    <div class="info">
                        <div style="flex:5">
                            <button type="button" class="btn btn-primary btn-sm">运行时长</button>
                            <span>3.677327 S</span>
                        </div>
                        <div style="flex:5">
                            <button type="button" class="btn btn-primary btn-sm ">测试人员</button>
                            <span>小测试</span>
                        </div>
                    </div>
                    <div class="info">
                        <div style="flex:5">
                            <button type="button" class="btn btn-primary btn-sm">成功用例</button>
                            <span>1</span>
                        </div>
                        <div style="flex:5">
                            <button type="button" class="btn btn-primary btn-sm ">通过率</button>
                            <span>2.86%</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel">
                <h2>通过率趋势图</h2>
                <div class="chart2" id="char2"></div>
            </div>
        </div>
        <div class="box3">
            <div class="panel">
                <h2>历史构建结果</h2>
                <div class="chart4">
                    <table class="table" style="color: #d6d6d6;padding: 0">
                        <thead>
                        <tr>
                            <th scope="col">执行时间</th>
                            <th scope="col">用例总数</th>
                            <th scope="col">成功用例数</th>
                            <th scope="col">通过率</th>
                        </tr>
                        </thead>
                        <tbody>
                        
                        <tr>
                            <th scope="row">2024-12-11 10:59:24</th>
                            <td>35</td>
                            <td>1</td>
                            <td>2.86%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 16:05:21</th>
                            <td>137</td>
                            <td>105</td>
                            <td>76.64%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 16:00:36</th>
                            <td>137</td>
                            <td>105</td>
                            <td>76.64%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 14:51:39</th>
                            <td>0</td>
                            <td>0</td>
                            <td>0%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 14:47:11</th>
                            <td>30</td>
                            <td>28</td>
                            <td>93.33%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 14:46:58</th>
                            <td>8</td>
                            <td>6</td>
                            <td>75.00%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 14:37:57</th>
                            <td>137</td>
                            <td>105</td>
                            <td>76.64%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-11-21 14:35:28</th>
                            <td>137</td>
                            <td>105</td>
                            <td>76.64%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-10-09 15:05:56</th>
                            <td>133</td>
                            <td>102</td>
                            <td>76.69%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-10-09 10:16:31</th>
                            <td>132</td>
                            <td>100</td>
                            <td>75.76%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-09-26 17:09:08</th>
                            <td>102</td>
                            <td>74</td>
                            <td>72.55%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-09-26 16:34:56</th>
                            <td>102</td>
                            <td>81</td>
                            <td>79.41%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-09-26 16:34:26</th>
                            <td>17</td>
                            <td>8</td>
                            <td>47.06%</td>
                        </tr>
                        
                        <tr>
                            <th scope="row">2024-09-23 15:10:53</th>
                            <td>102</td>
                            <td>48</td>
                            <td>47.06%</td>
                        </tr>
                        
                        </tbody>
                    </table>

                </div>
            </div>

        </div>
    </div>

    <div class="test_info">
        <h2>本次运行详情</h2>
        <div class="table_data">

            <table class="table" style="color: #fff">
                <thead class="text-light" style="background: rgba(3, 14, 70, 0.5)">
                <tr>
                    <th scope="col" style="width: 5%;padding: 0">编号</th>
                    <th scope="col" style="width: 20%;padding: 0">
                        <span>用例模块</span>
                        <select id="testClass">
                            <option>所有</option>
                            
                            <option value="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</option>
                            
                            <option value="caseexternaApitest_compareResultpy">case\externaApi\test_compareResult.py</option>
                            
                        </select>

                    </th>
                    <th scope="col" style="width: 15%;padding: 0">测试方法</th>
                    <th scope="col" style="width: 20%;padding: 0">用例描述</th>
                    <th scope="col" style="width: 10%;padding: 0">执行时间</th>
                    <th scope="col" style="width: 20%;padding: 0">

                        <span>执行结果</span>
                        <select id="testResult">
                            <option>所有</option>
                            <option class="text-success">成功</option>
                            <option class="text-danger">失败</option>
                            <option class="text-warning">错误</option>
                            <option class="text-info">跳过</option>
                        </select>

                    </th>
                    <th scope="col" style="width: 10%;padding: 0">详细信息</th>
                </tr>
                </thead>
                <tbody>
                
                <tr class="case_">
                    <td>1</td>
                    <td class="caseexternaApitest_compareResultpy">case\externaApi\test_compareResult.py</td>
                    <td>TestCodeSecAPI.test_compareResult</td>
                    <td>None</td>
                    <td>0.069165</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_compareResult.TestCodeSecAPI object at 0x0000018B4489FF20>

    def test_compareResult(self):
        base_path = f"/project/{projectUuid}/task/{appId}/compareResult"
        url = base_url + base_path
        parameter = {
            "lastRecordId": "4ef102d6-f462-49fc-b41b-4365fb54faa5",
            "recordId": "419f6d23-05dd-486b-823a-455c6c381c6c"
        }
>       response = send_request(url, "get", parameter, base_path)

case\externaApi\test_compareResult.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>2</td>
                    <td class="caseexternaApitest_compareResultpy">case\externaApi\test_compareResult.py</td>
                    <td>TestCodeSecAPI.test_compareVulDetailInfo</td>
                    <td>None</td>
                    <td>0.062401</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_compareResult.TestCodeSecAPI object at 0x0000018B44A3A420>

    def test_compareVulDetailInfo(self):
        base_path = f"/project/{projectUuid}/task/{appId}/compareVulDetailInfo"
        url = base_url + base_path
        parameter = {
            "lastRecordId": "4ef102d6-f462-49fc-b41b-4365fb54faa5",
            "recordId": "419f6d23-05dd-486b-823a-455c6c381c6c"
        }
>       response = send_request(url, "get", parameter, base_path)

case\externaApi\test_compareResult.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>3</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_prev</td>
                    <td>None</td>
                    <td>0.000382</td>
                    
                    
                    <td class="text-success">通过</td>
                    
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: delete from project where project_desc like '%接口创建项目%' and status_static_code !='3';
Affected rows: 1
Executing SQL: delete from project where name like '%projectDesc%' and status_static_code !='3';
Affected rows: 0
前置任务：SQL执行成功！
</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>4</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_none</td>
                    <td>0.066493</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3E120>, testcase = {'assert_csv': 'projectName：该字段不能为空', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>5</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_null</td>
                    <td>0.063278</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3E060>, testcase = {'assert_csv': 'projectName：该字段不能为空', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>6</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_toolong:513</td>
                    <td>0.068075</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3E3C0>, testcase = {'assert_csv': '项目名称必须由2-512个字符组成', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>7</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_tooshort</td>
                    <td>0.063044</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F350>, testcase = {'assert_csv': '项目名称必须由2-512个字符组成', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>8</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_onlyspace</td>
                    <td>0.067388</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F3E0>, testcase = {'assert_csv': 'projectName：该字段不能为空', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>9</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectNam_Contains special characters</td>
                    <td>0.062531</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F470>, testcase = {'assert_csv': '项目名称不能包含￥()？！', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>10</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_two characters</td>
                    <td>0.063768</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F500>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>11</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_512characters</td>
                    <td>0.063978</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F590>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>12</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectName_space and characters</td>
                    <td>0.069513</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F620>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>13</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_none</td>
                    <td>0.049854</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F6B0>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>14</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_null</td>
                    <td>0.050537</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F740>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>15</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_toolong 513characters</td>
                    <td>0.064661</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F7D0>, testcase = {'assert_csv': '项目描述最大长度为500个字符', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>16</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_onlyspace</td>
                    <td>0.066642</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F860>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>17</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_Contains special characters</td>
                    <td>0.047528</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F8F0>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>18</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_two characters</td>
                    <td>0.063841</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3F980>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>19</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>projectDesc_500characters</td>
                    <td>0.042721</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FA10>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>20</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url_none</td>
                    <td>0.057021</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FAA0>, testcase = {'assert_csv': 'url：该字段不能为空', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>21</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url_ok</td>
                    <td>0.049450</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FB30>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>22</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url_null</td>
                    <td>0.067879</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FBF0>, testcase = {'assert_csv': '不能为空', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>23</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url format error</td>
                    <td>0.059906</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FCB0>, testcase = {'assert_csv': 'GIT地址格式错误', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>24</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url_contains space</td>
                    <td>0.051776</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FD70>, testcase = {'assert_csv': 'GIT地址格式错误', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>25</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url_characters too long</td>
                    <td>0.074968</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FE30>, testcase = {'assert_csv': '地址最大长度为200个字符', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>26</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>url_contains special characters</td>
                    <td>0.047915</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FEF0>, testcase = {'assert_csv': 'GIT地址格式错误', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>27</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>urlHead=0</td>
                    <td>0.067013</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F3FFE0>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>28</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>urlHead=1</td>
                    <td>0.049551</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F58110>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>29</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>urlHead_null</td>
                    <td>0.062344</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F581D0>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>30</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>urlHead_illegal</td>
                    <td>0.065781</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F58290>, testcase = {'assert_csv': 'urlHead 参数类型错误', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>31</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>gitType_none</td>
                    <td>0.066218</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F58350>, testcase = {'assert_csv': 'git类型不能为空', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': 'none', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>32</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>gitType1_gitlab</td>
                    <td>0.047486</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F58410>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '1', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>33</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>gitType2_github</td>
                    <td>0.065932</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F584D0>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '2', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>34</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>gitType3_gitee</td>
                    <td>0.066071</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F58590>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'main', 'gitType_csv': '3', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
                <tr class="case_">
                    <td>35</td>
                    <td class="caseexternaApitest_createProjectByGitInfopy">case\externaApi\test_createProjectByGitInfo.py</td>
                    <td>TestCodeSecAPI.test_createProjectByGitInfo</td>
                    <td>gitType6_gerrit</td>
                    <td>0.074856</td>
                    
                    <td class="text-warning">失败</td>
                    
                    <td>
                        <button type="button" class="btn btn_info btn-primary btn-sm">查看详情</button>
                    </td>
                </tr>

                <tr class="test_log">
                    <td colspan="7" class="small text-muted" style=" word-wrap:break-word; word-break:break-all;padding: 0">
                        <div class="card" style="background: rgba(3, 14, 70, 0.5)">
                            <div class="card-body">
                                <ul class="nav nav-tabs" role="tablist">
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link active" data-toggle="tab" role="tab" aria-controls="home"
                                           aria-selected="true" style="padding: 0 16px">运行日志</a>
                                    </li>
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="profile"
                                           aria-selected="false" style="padding: 0 16px">调试输出</a>
                                    </li>
                                    
                                    <li class="nav-item" role="presentation">
                                        <a class="nav-link" data-toggle="tab" role="tab" aria-controls="contact"
                                           aria-selected="false" style="padding: 0 16px">异常信息</a>
                                    </li>
                                    
                                    

                                </ul>
                                <div class="tab-content" style="height: 300px;overflow-y: auto;padding: 20px">

                                    <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="profile-tab">
                                        <pre style="line-height: 18px"></pre>
                                    </div>
                                    <div class="tab-pane fade" role="tabpanel" aria-labelledby="contact-tab">
                                        <pre style="line-height: 18px">Executing SQL: CREATE TABLE IF NOT EXISTS autotest_user_token (  
    id INT AUTO_INCREMENT PRIMARY KEY,  -- 自增ID  
    email TEXT NOT NULL, 
    authorization TEXT NOT NULL,  
    loginNonce TEXT NOT NULL,  
    userId TEXT NOT NULL,  
    token TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP  -- 创建时间
)
Affected rows: 0
Executing SQL: SELECT * FROM `ssp_v4`.`autotest_user_token` where email = 'sec@seczone.cn' ORDER BY `id` DESC;
Affected rows (for SELECT): 1

使用数据库token!
[{'id': 2, 'email': 'sec@seczone.cn', 'authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyRGV0YWlsIjp7InVzZXJJZCI6ImZiOWQ2MDMyLWUzZmYtNDM1Ny04YzQyLTE4YTE3ZmQ4NTViZiIsImVtYWlsIjoic2VjQHNlY3pvbmUuY24iLCJ1c2VybmFtZSI6InNlY0BzZWN6b25lLmNuIiwidG9rZW4iOiI3YzU5NTUxOC0zNDI1LTRhMTgtOGI5OS1iNjExNDBjMTQyNDAiLCJyb2xlcyI6WyJST0xFX2dyb3VwYWRtaW4iXSwiZW5hYmxlZCI6dHJ1ZSwiYWNjb3VudE5vbkV4cGlyZWQiOnRydWUsImFjY291bnROb25Mb2NrZWQiOnRydWUsImNyZWRlbnRpYWxzTm9uRXhwaXJlZCI6dHJ1ZSwicGFzc3dvcmQiOm51bGwsImF1dGhvcml0aWVzIjpbeyJhdXRob3JpdHkiOiJST0xFX2dyb3VwYWRtaW4ifV19LCJzdWIiOiJmYjlkNjAzMi1lM2ZmLTQzNTctOGM0Mi0xOGExN2ZkODU1YmYiLCJqdGkiOiI3MjRiNjU3OC05YjM2LTRiNmYtODI2MC1mYzVjMDQ5ZmI0MzAifQ.Igzu5WNtlpaLajXLA58Y48mZvw5OwYgXKECcRdf_Eu1VPT8liA9O0_Uke4Yc227EE13AsYAYw-1SkAfcQbTM1g', 'loginNonce': 'e54d58ef-95cb-4fe0-aec9-216b8257ae98', 'userId': 'fb9d6032-e3ff-4357-8c42-18a17fd855bf', 'token': '7c595518-3425-4a18-8b99-b61140c14240', 'created_at': datetime.datetime(2024, 12, 2, 10, 37, 25), 'expires_at': datetime.datetime(2024, 12, 2, 10, 42, 25)}]
</pre>
                                    </div>
                                    
                                    <div class="tab-pane fade " role="tabpanel" aria-labelledby="home-tab">
                                        <pre style="line-height: 18px">self = <CodesecApi.case.externaApi.test_createProjectByGitInfo.TestCodeSecAPI object at 0x0000018B44F58650>, testcase = {'assert_csv': '成功', 'authenticationMethod_csv': '0', 'branch_csv': 'master', 'gitType_csv': '6', ...}

    @pytest.mark.parametrize("testcase", request_data, ids=request_ids)  # ids指定用例名称
    def test_createProjectByGitInfo(self, testcase):
        base_path = f"/project/createProjectByGitInfo"
        url = base_url + base_path
        parameter = {
            "projectName": testcase.get("projectName_csv"),
            "gitType": testcase.get("gitType_csv"),
            "authenticationMethod": testcase.get("authenticationMethod_csv"),
            "url": testcase.get("url_csv"),
            "projectDesc": testcase.get("projectDesc_csv"),
            "urlHead": testcase.get("urlHead_csv"),
            "isTokenEncrypt": testcase.get("isTokenEncrypt_csv"),
            "branch": testcase.get("branch_csv"),
            "tag": testcase.get("tag_csv"),
            "checkCommitId": "",
            "commitId": "",
            "extraMark": "",
            "fileFilter": "",
            "callBackUrl": "",
            "language": "1",
            "type": "1",
            "isOpenDepend": "",
            "depotId": "",
            "pullFileName": "",
            "ruleSetId": "",
            "orgUuid": "00a7b33e-f075-4758-9ef0-d1bb989748ac",
            "fastScan": "",
            "isIncrScan": ""
        }
        # 处理认证方式
        if testcase.get("authenticationMethod_csv") == "0":
            parameter["name"] = testcase.get("username_csv")
            parameter["password"] = rsa_encode(testcase.get("password_csv"))
        elif testcase.get("authenticationMethod_csv") == "1":
            parameter["token"] = rsa_encode(testcase.get("token_csv"))
            if testcase.get("isTokenEncrypt_csv").lower() == "false":
                parameter["token"] = testcase.get("token_csv")
        else:
            parameter["sshKey"] = rsa_encode(testcase.get("sshKey_csv"))
    
>       response = send_request(url, "post", parameter, base_path)

case\externaApi\test_createProjectByGitInfo.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
CodeSecTool.py:300: in send_request
    header = external_header(parameter, base_path, email_str=email_user, password_str=password_str)[0]
CodeSecTool.py:268: in external_header
    openToken = create_opentoken(email_str=email_str, password_str=password_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

email_str = 'sec@seczone.cn', password_str = 'Seczone@123'

    def create_opentoken(email_str=email, password_str=password):
        openToken = get_opentoken(email_str=email_str, password_str=password_str)
        if openToken is None:
            url = cs_url + "/CodeSecInterfaceService/user/openToken/create"
            # 列表入参
            nameValueList = [
                ("openTypeIds", "5"),
                ("openTypeIds", "1"),
                ("openTypeIds", "9"),
                ("openTypeIds", "7"),
                ("openTypeIds", "4"),
                ("openTypeIds", "10"),
                ("openTypeIds", "2"),
                ("openTypeIds", "6"),
                ("openTypeIds", "11"),
                ("expiredDate", "2099-12-06 23:59:59")
            ]
            response = requests.post(url=url, headers=headers, data=nameValueList)
            response_json = response.json()
            # print("更新opentoken：",response_json)
>           openToken = response_json['openToken']
E           KeyError: 'openToken'

CodeSecTool.py:370: KeyError</pre>
                                    </div>
                                    
                                    


                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                
            </table>
        </div>

        <div style="height: 200px"></div>
    </div>

</div>




<script type="text/javascript">

    const resulte = {
            "success": `1`,
            "all": `35`,
            "fail": `34`,
            "skip": '0',
            "error": `0`,
            "runtime": '3.677327 S',
            "begin_time": "1733885964.93136",
            "pass_rate": '2.86',
        }
    ;
    const history = [{'success': 48, 'all': 102, 'fail': 50, 'skip': 3, 'error': 1, 'runtime': '45.466580 S', 'begin_time': '2024-09-23 15:10:53', 'pass_rate': '47.06'}, {'success': 8, 'all': 17, 'fail': 9, 'skip': 0, 'error': 0, 'runtime': '11.069731 S', 'begin_time': '2024-09-26 16:34:26', 'pass_rate': '47.06'}, {'success': 81, 'all': 102, 'fail': 17, 'skip': 3, 'error': 1, 'runtime': '64.819058 S', 'begin_time': '2024-09-26 16:34:56', 'pass_rate': '79.41'}, {'success': 74, 'all': 102, 'fail': 24, 'skip': 3, 'error': 1, 'runtime': '61.165764 S', 'begin_time': '2024-09-26 17:09:08', 'pass_rate': '72.55'}, {'success': 100, 'all': 132, 'fail': 26, 'skip': 3, 'error': 3, 'runtime': '15.298177 S', 'begin_time': '2024-10-09 10:16:31', 'pass_rate': '75.76'}, {'success': 102, 'all': 133, 'fail': 25, 'skip': 3, 'error': 3, 'runtime': '12.430845 S', 'begin_time': '2024-10-09 15:05:56', 'pass_rate': '76.69'}, {'success': 105, 'all': 137, 'fail': 22, 'skip': 6, 'error': 4, 'runtime': '14.515715 S', 'begin_time': '2024-11-21 14:35:28', 'pass_rate': '76.64'}, {'success': 105, 'all': 137, 'fail': 22, 'skip': 6, 'error': 4, 'runtime': '14.254777 S', 'begin_time': '2024-11-21 14:37:57', 'pass_rate': '76.64'}, {'success': 6, 'all': 8, 'fail': 2, 'skip': 0, 'error': 0, 'runtime': '1.508543 S', 'begin_time': '2024-11-21 14:46:58', 'pass_rate': '75.00'}, {'success': 28, 'all': 30, 'fail': 2, 'skip': 0, 'error': 0, 'runtime': '4.058803 S', 'begin_time': '2024-11-21 14:47:11', 'pass_rate': '93.33'}, {'success': 0, 'all': 0, 'fail': 0, 'skip': 0, 'error': 0, 'runtime': '0.561317 S', 'begin_time': '2024-11-21 14:51:39', 'pass_rate': 0}, {'success': 105, 'all': 137, 'fail': 22, 'skip': 6, 'error': 4, 'runtime': '16.836014 S', 'begin_time': '2024-11-21 16:00:36', 'pass_rate': '76.64'}, {'success': 105, 'all': 137, 'fail': 22, 'skip': 6, 'error': 4, 'runtime': '15.729050 S', 'begin_time': '2024-11-21 16:05:21', 'pass_rate': '76.64'}, {'success': 1, 'all': 35, 'fail': 34, 'skip': 0, 'error': 0, 'runtime': '3.677327 S', 'begin_time': '2024-12-11 10:59:24', 'pass_rate': '2.86'}];

    var passRate = [];
    var dTime = [];
    history.forEach(function (item, index, array) {
        passRate.push(item.pass_rate);
        dTime.push(item.begin_time)
    });
    if (passRate.length === 1) {
        passRate.unshift(0);
        dTime.unshift(0)
    }

    function char01() {
        let myChart = echarts.init(document.getElementById('char1'));
        let option = {
            color: ['#28a745', '#ffc107', '#dc3545', '#17a2b8'],
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b}: {c} ({d}%)',
                backgroundColor: 'rgba(3, 14, 70, 0.5)',
                borderColor: '#333',
                textStyle: {
                    color: '#fff',
                    fontSize: "13"
                },
            },
            legend: {
                bottom: "0%",
                // 小图标的宽度和高度
                itemWidth: 10,
                itemHeight: 10,
                data: ['通过', '失败', '错误', '跳过'],
                textStyle: {
                    color: "rgba(255,255,255,.5)",
                    fontSize: "12"
                },
            },
            series: [
                {
                    name: '测试结果',
                    type: 'pie',
                    radius: ['50%', '70%'],
                    avoidLabelOverlap: false,
                    label: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        label: {
                            show: true,
                            fontSize: '20',
                            fontWeight: 'bold',
                            color: '#fff',
                        }
                    },
                    labelLine: {
                        show: false
                    },
                    data: [
                        {value: resulte.success, name: '通过'},
                        {value: resulte.fail, name: '失败'},
                        {value: resulte.error, name: '错误'},
                        {value: resulte.skip, name: '跳过'}
                    ]
                }
            ]
        };
        myChart.setOption(option)

    }

    char01();

    //    大图
    function char02() {

        // 基于准备好的dom，初始化echarts实例
        let myChart = echarts.init(document.getElementById("char2"));
        // 2. 指定配置和数据
        option = {
            tooltip: {
                trigger: 'axis',
                formatter: '{a} <br/>{b}:  ({c}%)',
                backgroundColor: 'rgba(3, 14, 70, 0.5)',
                borderColor: '#333',
                textStyle: {
                    color: '#fff',
                    fontSize: "13"
                },
            },

            grid: {
                left: "10",
                top: "30",
                right: "10",
                bottom: "0",
                containLabel: true
            },

            xAxis: [{
                type: "category",
                boundaryGap: false,
                show: false,
                axisLabel: {
                    textStyle: {
                        color: "rgba(255,255,255,.6)",
                        fontSize: 12
                    }
                },
                axisLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.2)"
                    }
                },

                data: dTime
            },
                {
                    axisPointer: {
                        show: false
                    },
                    axisLine: {
                        show: false
                    },
                    position: "bottom",
                    offset: 20
                }
            ],

            yAxis: [{
                type: "value",
                axisTick: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.1)"
                    }
                },
                axisLabel: {
                    textStyle: {
                        color: "rgba(255,255,255,.6)",
                        fontSize: 12
                    }
                },

                splitLine: {
                    lineStyle: {
                        color: "rgba(255,255,255,.1)"
                    }
                }
            }],
            series: [{
                name: "通过率",
                type: "line",
                smooth: true,
                symbol: "circle",
                symbolSize: 5,
                showSymbol: true,
                lineStyle: {
                    normal: {
                        color: "#0184d5",
                        width: 2
                    }
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(
                            0,
                            0,
                            0,
                            1,
                            [{
                                offset: 0,
                                color: "rgba(1, 132, 213, 0.4)"
                            },
                                {
                                    offset: 0.8,
                                    color: "rgba(1, 132, 213, 0.1)"
                                }
                            ],
                            false
                        ),
                        shadowColor: "rgba(0, 0, 0, 0.1)"
                    }
                },
                itemStyle: {
                    normal: {
                        color: "#0184d5",
                        borderColor: "rgba(221, 220, 107, .1)",
                        borderWidth: 18
                    }
                },
                data: passRate
            },
            ]
        };
        // 重新把配置好的新数据给实例对象
        myChart.setOption(option);

    }

    char02();

    function char03() {
        // 基于准备好的dom，初始化echarts实例
        let myChart = echarts.init(document.getElementById("char3"));
        var data = [resulte.success, resulte.fail, resulte.error, resulte.skip];
        var titlename = ["通过用例", "失败用例", "错误用例", "跳过用例",];
        var valdata = [resulte.all, resulte.all, resulte.all, resulte.all];
        var myColor = ['#28a745', '#ffc107', '#dc3545', '#17a2b8'];
        option = {
            //图标位置
            grid: {
                top: "10%",
                left: "22%",
                bottom: "10%"
            },
            xAxis: {
                show: false
            },
            yAxis: [{
                show: true,
                data: titlename,
                inverse: true,
                axisLine: {
                    show: false
                },
                splitLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                axisLabel: {
                    color: "#fff",

                    rich: {
                        lg: {
                            backgroundColor: "#339911",
                            color: "#fff",
                            borderRadius: 15,
                            align: "center",
                            width: 15,
                            height: 15
                        }
                    }
                }
            },
                {
                    show: false,
                    inverse: true,
                    data: valdata,
                    axisLabel: {
                        textStyle: {
                            fontSize: 12,
                            color: "#fff"
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    axisLine: {
                        show: false
                    },
                }
            ],
            series: [{
                type: "bar",
                yAxisIndex: 0,
                data: data,
                barCategoryGap: 50,
                barWidth: 18,
                itemStyle: {
                    normal: {
                        barBorderRadius: 20,
                        color: function (params) {
                            var num = myColor.length;
                            return myColor[params.dataIndex % num];
                        }
                    }
                },
                label: {
                    normal: {
                        show: true,
                        position: "right",
                        formatter: "{c}条",
                        color: "#fff",

                    }
                }
            },
                {
                    type: "bar",
                    yAxisIndex: 1,
                    barCategoryGap: 50,
                    data: valdata,
                    barWidth: 20,
                    itemStyle: {
                        normal: {
                            color: "none",
                            borderColor: "#00c1de",
                            borderWidth: 2,
                            barBorderRadius: 15
                        }
                    }
                }
            ]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });
    }

    char03()

</script>


<script>
    var tbodyTr = $('tbody .case_');
    var testResult = $("#testResult");
    var testClass = $("#testClass");
    <!--    用例执行详细信息显示切换-->
    $(".btn_info").click(function () {
        $(this).parent().parent().next().toggle();

    });
    // 当选择用例类之后触发
    testClass.change(function () {
        $('.test_log').hide();
        var cls = $(this).val();
        var res = testResult.val();
        elementDisplay(cls, res);
        sort()
    });
    testResult.change(function () {
        var res = $(this).val();
        var cls = testClass.val();
        elementDisplay(cls, res);
        sort()
    });

    function elementDisplay(cls, res) {
        // 用例数据的显示
        if (cls === "所有") {
            if (res === "所有") {
                tbodyTr.has('button').show();
            } else if (res === '成功') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.text-success').show()

            } else if (res === '错误') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.text-danger').show()

            } else if (res === '失败') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.text-warning').show()

            } else if (res === '跳过') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.text-info').show()
            }
        } else {
            if (res === "所有") {
                tbodyTr.hide();
                tbodyTr.has('button').has('.' + cls + '').show()
            } else if (res === '成功') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.' + cls + '').has('.text-success').show()
            } else if (res === '错误') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.' + cls + '').has('.text-danger').show()
            } else if (res === '失败') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.' + cls + '').has('.text-warning').show()
            } else if (res === '跳过') {
                tbodyTr.hide();
                tbodyTr.has('button').has('.' + cls + '').has('.text-info').show()
            }
        }
    }

    function sort() {
        //重新排列显示序号
        // 选择所有可以见的tr
        var visibleTr = tbodyTr.filter(":visible");

        visibleTr.each(function (index, element) {
            element.firstElementChild.innerHTML = index + 1;

        })

    }

    $('.nav-tabs li').click(function () {
        $(this).find('a').addClass('active');
        $(this).siblings().find('a').removeClass('active');
        $(this).parent().next().children('.tab-content div').eq($(this).index()).addClass('active show').siblings().removeClass('active show')
    });

</script>


</body>
</html>